<template>
  <div>
    test1
    <span>{{mylove}}</span>
    <button @click="changeName">修改</button>
    <Test2/>
  </div>
</template>

<script lang="ts">
import { inject, ref } from 'vue'
import Test2 from './Test2.vue'
export default {
  name: 'Test1',
  components: {
    Test2
  },
  setup () {
    const name = ref<string>('xiaohua')
    const mylove = inject('mylove')
    const changeName = () => {
      // @ts-ignore
      mylove.value = 'lijiaxian'
    }
    return {
      mylove,
      changeName
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
